﻿using SqlSugar;
using System;
using System.Text;
using System.Collections.Generic;
using System.Data;
using GKQC.DbHelper.ViewModels;

namespace GKQC.DbHelper.DbModels
{
	/// <summary>
	/// 车间管理
	/// </summary>
	[SugarTable("t_wrk_head")]
	public class WorkshopModel
	{
		public WorkshopModel()
        {
			this.SourceNo = string.Empty;
			this.Shifts = string.Empty;
			this.Machine = string.Empty;
			this.CreateUserCode = string.Empty;
			this.CreateUserCode = string.Empty;
			this.CreateUser = string.Empty;
			this.Operator = string.Empty;
			this.Procudure = string.Empty;
			this.Station = string.Empty;
			this.End = string.Empty;
			this.Start = string.Empty;
			this.WorkshopMaterials = new List<WorkshopMaterialModel>();
			this.WorkshopBads = new List<WorkshopBadModel>();
			this.WorkshopAgeingVoltages = new List<WorkshopVoltageModel>();
			this.PlanStartDate = DateTime.Now;
			this.PlanEndDate = DateTime.Now;
			this.StartDate = DateTime.Now;
			this.EndDate = DateTime.Now;
			this.Id = -1;
		}

		/// <summary>
		/// 流水号
		/// </summary>	
		[SugarColumn(IsPrimaryKey = true)] //是主键
		public long Id { get; set; }
		/// <summary>
		/// 派工单号
		/// </summary>		
		public string SourceNo { get; set; }
		/// <summary>
		/// 班次
		/// </summary>		
		public string Shifts { get; set; }
		/// <summary>
		/// 机台
		/// </summary>		
		public string Machine { get; set; }
		/// <summary>
		/// 建立人代号
		/// </summary>		
		public string CreateUserCode { get; set; }
		/// <summary>
		/// 建立人
		/// </summary>		
		public string CreateUser { get; set; }
		/// <summary>
		/// 作业员
		/// </summary>		
		public string Operator { get; set; }
		/// <summary>
		/// 建立日期
		/// </summary>		
		public DateTime CreateDate { get; set; }
		/// <summary>
		/// 计划开工时间
		/// </summary>		
		public DateTime? PlanStartDate { get; set; }
		/// <summary>
		/// 计划完工时间
		/// </summary>		
		public DateTime? PlanEndDate { get; set; }
		/// <summary>
		/// 实际开始时间
		/// </summary>		
		public DateTime? StartDate { get; set; }
		/// <summary>
		/// 实际结束时间
		/// </summary>		
		public DateTime? EndDate { get; set; }
		/// <summary>
		/// 料号
		/// </summary>		
		public string Pn { get; set; }
		/// <summary>
		/// 投入数量
		/// </summary>		
		public double Qty { get; set; }
		/// <summary>
		/// 良品数
		/// </summary>		
		public double GoodQty { get; set; }
		/// <summary>
		/// 不良品数
		/// </summary>		
		public double BadQty { get; set; }
		/// <summary>
		/// 制程
		/// </summary>		
		public string Procudure { get; set; }
		/// <summary>
		/// 工位
		/// </summary>		
		public string Station { get; set; }
		/// <summary>
		/// 标准工时(分钟)
		/// </summary>		
		public int PlanTime { get; set; }
		/// <summary>
		/// 实际工时(分钟)
		/// </summary>		
		public int Time { get; set; }
		/// <summary>
		/// 是否已开工
		/// </summary>		
		public string Start { get; set; }
		/// <summary>
		/// 是否已完工
		/// </summary>		
		public string End { get; set; }
		/// <summary>
		/// 审核人
		/// </summary>		
		public string ApproveUser { get; set; }
		/// <summary>
		/// 审核日期
		/// </summary>		
		public DateTime? ApproveDate { get; set; }
		/// <summary>
		/// 审核人代号
		/// </summary>		
		public string ApproveUserCode { get; set; }
		/// <summary>
		/// 更新日期
		/// </summary>		
		public DateTime? ModiDate { get; set; }
		/// <summary>
		/// 修改人
		/// </summary>		
		public string ModiUser { get; set; }
		/// <summary>
		/// 修改人代号
		/// </summary>		
		public string ModiUserCode { get; set; }

		public string Remark { get; set; }

		/// <summary>
		/// 不良记录
		/// </summary>
		[SugarColumn(IsIgnore = true)]
		public List<WorkshopBadModel> WorkshopBads { get; set; }

		/// <summary>
		/// 上料记录
		/// </summary>
		[SugarColumn(IsIgnore = true)]
		public List<WorkshopMaterialModel> WorkshopMaterials { get; set; }
		/// <summary>
		/// 老化电压
		/// </summary>
		[SugarColumn(IsIgnore = true)]
		public List<WorkshopVoltageModel> WorkshopAgeingVoltages { get; set; }
	}
}

